package com.bk.ui.controller;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import com.cenjiawen.common.IndexController;
import com.jfinal.aop.Clear;
import com.jfinal.kit.LogKit;
import com.jfinal.kit.PropKit;
import com.jfinal.weixin.sdk.kit.IpKit;

public class BKHomeController extends IndexController {
	protected final boolean DEBUG = PropKit.getBoolean("devMode", false);

	@Clear
	@Override
	public void index() {
		if (DEBUG) {
			String LOCAL_HOST = "0:0:0:0:0:0:0:1";
			String ip = IpKit.getRealIpV2(getRequest());
			if (LOCAL_HOST.equals(ip)) {

			} else {
				HttpServletRequest request = getRequest();
				Enumeration<String> header = request.getHeaderNames();
				while (header.hasMoreElements()) {
					String string = (String) header.nextElement();
					String value = request.getHeader(string);
					System.out.println(string + " - " + value);
				}
				LogKit.info(IpKit.getRealIpV2(getRequest()));
			}
		}
		render("/bk/HtmlMobileTemplate.html");
	}
}
